#include<bits/stdc++.h>

using namespace std;

class Solution {
public:
    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {
        int cnt = 0;

        for (vector<string> it : items)
        {
            if (ruleKey == "type")
            {
                if (ruleValue == it[0])
                {
                    cnt++;
                }
            }
            if (ruleKey == "color")
            {
                if (ruleValue == it[1])
                {
                    cnt++;
                }
            }
            if (ruleKey == "name")
            {
                if (ruleValue == it[2])
                {
                    cnt++;
                }
            }
        }
        return cnt;
    }
};